package com.jhoncy.myproject.system.ctrl;

import com.jhoncy.myproject.system.entity.SysMenu;
import com.jhoncy.myproject.system.service.SysMenuService;
import com.jhoncy.myproject.common.dto.RestResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 菜单
 * @author zhuangqi
 * @@date 2017/3/14.
 */
@RestController
@RequestMapping(value = "/sys/menu")
public class SysMenuCtrl {

    @Autowired
    private SysMenuService sysMenuService;

    /**
     * 根据userId获取菜单
     * @param userId
     * @return
     */
    @GetMapping(value = "/userid/{userId}")
    public RestResponse<List<SysMenu>> listMenu(@PathVariable String userId) {
        RestResponse<List<SysMenu>> response = new RestResponse<>();
        response.setData(sysMenuService.listMenuByUserId(userId));
        return response;
    }


}
